/**
 * @description: 判断是否为https/mailto/tel 开头的外部链接
 * @author: zengxiaolong
 * @Date: 2023-02-22 21:18:18
 * @param {String} path 外链接
 * @return {Boolean}
 */
export function isExternal(path) {
  return /^(https?:|mailto:|tel:)/.test(path)
}

/**
 * @description: 验证登录者
 * @author: zengxiaolong
 * @Date: 2023-02-22 21:23:35
 * @param {String} str
 * @return {Boolean}
 */
export function validUsername(str) {
  const valid_map = ['admin', 'editor']
  return valid_map.indexOf(str.trim()) >= 0
}
